// 首页信息
class HomePageInfo {
  final ExamInfo examInfo;
  final List slides;
  final List courseRows;
  final List examPaperRows;
  HomePageInfo({this.examInfo, this.slides, this.courseRows, this.examPaperRows});

  factory HomePageInfo.fromJson(Map<String, dynamic> json) {
    return HomePageInfo(
      examInfo: ExamInfo.fromJson(json['examInfo']),
      slides: json['slides'] == null ? []: json['slides'] as List,
      courseRows: json['courseRows'] == null ? []: json['courseRows'] as List,
      examPaperRows: json['examPaperRows'] == null ? []: json['examPaperRows'] as List,
    );
  }
}
// 考试信息
class ExamInfo {
  final String examTitle;
  final String examCode;
  final String examDate;
  final String examExplain;
  final String createTime;
  final int remainderDays;

  ExamInfo({this.examTitle, this.examCode, this.examDate, this.examExplain, this.createTime, this.remainderDays});

  factory ExamInfo.fromJson(Map<String, dynamic> json) {
    return ExamInfo(
      examTitle: json['examTitle'] as String,
      examCode: json['examCode'] as String,
      examDate: json['examDate'] as String,
      examExplain: json['examExplain'] as String,
      createTime: json['createTime'] as String,
      remainderDays: json['remainderDays'] as int,
    );
  }
}

class HomePageImageInfo {
  final String pictureUrl;
  HomePageImageInfo({this.pictureUrl});

  factory HomePageImageInfo.fromJson(Map<String, dynamic> json) {
    return HomePageImageInfo(
        pictureUrl: json['pictureUrl'] as String
    );
  }
}
// 题目
class Question {
  final int id;
  final String main;
  final String mainImageUrl;
  final String answer;
  final String answerImageUrl;
  final List options;
  int collectFlag;
  final String typeName;
  final int sourceType;
  int courseId;
  int sort;
  Question({this.id, this.main, this.mainImageUrl, this.answer, this.answerImageUrl,this.options, this.collectFlag, this.typeName, this.sourceType, this.courseId, this.sort});

  setCollectFlag(int collectFlag){
    this.collectFlag = collectFlag;
  }

  factory Question.fromJson(Map<String, dynamic> json) {
    return Question(
        id: json['id'] as int,
        main: json['main'] as String,
        mainImageUrl: json['mainImageUrl'] as String,
        answer: json['answer'] as String,
        answerImageUrl: json['answerImageUrl'] as String,
        options: json['options'] as List,
        collectFlag: json['collectFlag'] as int,
        typeName: json['typeName'] == null? "": json['typeName'] as String,
        sourceType: json['sourceType'] as int,
        courseId: json['courseId'] as int,
        sort: json['sort'] as int,
    );
  }
}

// 课程
class Course {
  final int id;
  final String name;
  final String subTitle;
  final String code;
  final String logoUrl;

  Course({this.id, this.name, this.subTitle, this.code, this.logoUrl});
  factory Course.fromJson(Map<String, dynamic> json) {
    return Course(
        id: json['id'] as int,
        name: json['name'] as String,
        subTitle: json['subTitle'] == null ? '': json['subTitle'] as String,
        code: json['code'] as String,
        logoUrl: json['logoUrl'] as String
    );
  }
}
// 章节
class Chapter {
  final int id;
  final String name;
  final String smallName;
  final String code;
  final String logoUrl;

  Chapter({this.id, this.name, this.smallName, this.code, this.logoUrl});
  factory Chapter.fromJson(Map<String, dynamic> json) {
    return Chapter(
        id: json['id'] as int,
        name: json['name'] as String,
        smallName: json['smallName'] == null ? '': json['smallName'] as String,
        code: json['code'] as String,
        logoUrl: json['logoUrl'] as String
    );
  }
}
// 试卷
class ExamPaper {
  final int id;
  final String examPaperName;
  final String smallName;
  final String examPaperCode;
  final String logoUrl;
  final String courseCode;
  final String courseName;

  ExamPaper({this.id, this.examPaperName, this.smallName, this.examPaperCode, this.logoUrl, this.courseCode, this.courseName});
  factory ExamPaper.fromJson(Map<String, dynamic> json) {
    return ExamPaper(
        id: json['id'] as int,
        examPaperName: json['examPaperName'] as String,
        smallName: json['smallName'] == null ? '': json['smallName'] as String,
        examPaperCode: json['examPaperCode'] as String,
        logoUrl: json['logoUrl'] as String,
        courseName: json['courseName'] as String,
        courseCode: json['courseCode'] as String
    );
  }
}
// 考卷试题VO
class ExamPaperQuestionVo {
  final int id;
  final String examPaperName;
  final String smallName;
  final String examPaperCode;
  final String courseCode;

  final ExamPaperQuestion jdaTi;
  final ExamPaperQuestion tKongTi;
  final ExamPaperQuestion xzeTi;
  final ExamPaperQuestion yYongTi;

  ExamPaperQuestionVo({this.id, this.examPaperName, this.smallName, this.examPaperCode, this.courseCode,
    this.jdaTi, this.tKongTi, this.xzeTi, this.yYongTi })
  ;
  factory ExamPaperQuestionVo.fromJson(Map<String, dynamic> json) {
    return ExamPaperQuestionVo(
        id: json['id'] as int,
        examPaperName: json['examPaperName'] as String,
        smallName: json['smallName'] == null ? '': json['smallName'] as String,
        examPaperCode: json['examPaperCode'] as String,
        courseCode: json['courseCode'] as String,
        jdaTi: ExamPaperQuestion.fromJson(json['jdaTi']),
        tKongTi: ExamPaperQuestion.fromJson(json['tkongTi']),
        xzeTi: ExamPaperQuestion.fromJson(json['xzeTi']),
        yYongTi: ExamPaperQuestion.fromJson(json['yyongTi']),
    );
  }
}
// 考卷试题
class ExamPaperQuestion {
  final int type;
  final int score;
  final String name;
  final int size;
  final List rows;
  ExamPaperQuestion({this.type, this.score, this.name, this.size,this.rows});
  factory ExamPaperQuestion.fromJson(Map<String, dynamic> json) {
    return ExamPaperQuestion(
        type: json['type'] as int,
        score: json['score'] == null ? 0: json['score'] as int,
        name: json['name'] as String,
        size: json['size'] == null ? 0 :json['size'] as int,
        rows: json['rows'] as List,
    );
  }
}

// 分页响应
class PageResponse {
  final int status;
  final String msg;
  final Page data;

  PageResponse({this.status, this.msg, this.data});
  factory PageResponse.fromJson(Map<String, dynamic> json) {
    return PageResponse(
        status: json['status'] as int,
        msg: json['msg'] as String,
        data: Page.fromJson(json['data'])
    );
  }
}

// 分页model
class Page {

  final int total;
  final int size;
  final int current;
  final int pages;
  final bool optimizeCountSql;
  final bool isSearchCount;
  final List<Object> records;
  Page({this.total, this.size, this.current, this.pages, this.optimizeCountSql, this.isSearchCount, this.records});

  factory Page.fromJson(Map<String, dynamic> json) {
    return Page(
        total: json['total'] as int,
        size: json['size'] as int,
        current: json['current'] as int,
        pages: json['pages'] as int,
        optimizeCountSql: json['optimizeCountSql'] as bool,
        isSearchCount: json['isSearchCount'] as bool,
        records: json['records'] as List<Object>
    );
  }
}

// 版本信息
class VersionInfo {
  final int versionFlag;
  final int appSize;
  final String versionNum;
  final String downLoadUrl;
  final String appMd5;
  final String verExplain;
  final String releaseTime;

  VersionInfo({this.versionFlag, this.versionNum, this.downLoadUrl, this.appMd5,this.appSize, this.verExplain, this.releaseTime});
  factory VersionInfo.fromJson(Map<String, dynamic> json) {
    return VersionInfo(
        versionFlag: json['versionFlag'] as int,
        appSize: json['appSize'] as int,
        versionNum: json['versionNum'] as String,
        downLoadUrl: json['downLoadUrl'] as String,
        appMd5: json['appMd5'] as String,
        verExplain: json['verExplain'] as String,
        releaseTime: json['releaseTime'] as String
    );
  }
}

